#!/usr/bin/env bash
set -e
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1

sealos exec "mkdir -p /opt/nvidia-runtime/rpms"
sealos scp ../opt/nvidia-runtime/ /opt/nvidia-runtime/
sealos exec "rpm -ivh /opt/nvidia-runtime/*.rpm"

sealos exec "mkdir -p /opt/nvidia-runtime/configs"
sealos scp ../configs/ /opt/nvidia-runtime/configs

sealos exec "cp -f /opt/nvidia-runtime/configs/config.toml.nvidia /etc/contianerd/config.toml"
sealos exec "systemctl restart containerd.service"


kubectl apply -f ../manifests/nvidia-device-plugin.yml
